/**
 * 消息模块接口路由
 * 接口:
 * POST /message/send
 */
var mmlog=require("../sever/mmlog").root("[routes/message.js]");
var express = require('express');
var router = express.Router();
var _message = require("../sever/message");

/**
 * 回复客户消息
 * 消息对象模型:
 * keyId,type,content
 */
router.post('/send', function(req, res, next) {
	var data = req.body;
	var id = data.keyId;
	_message.sendMessage(id, data, function(result) {
		res.json(result);
	})
});
router.get('/query/:sessionId', function(req, res, next) {
	var id = req.params.sessionId;
	_message.queryMessageBySessionId(id, function(result) {
		res.json(result);
	})
});

module.exports = router;